package com.roomio.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.roomio.core.dao.impl.GenericJPADAO;
import com.roomio.core.security.model.User;
import com.roomio.dao.UserInfoDAO;

@Repository("userInfoDAO")
public class UserInfoDAOImpl extends GenericJPADAO<User, Long> implements UserInfoDAO {
	
	@Override
	public User findUserByEmail(String username) {
		List<User> userList = findByQuery("from User u where email=:username ", new String[]{"username"}, new Object[]{username});
		if(userList!= null && userList.size()>0){
			return userList.get(0);
		}else{
			return null;
		}
	}
	
}